import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/third_login_entity.dart';

ThirdLoginEntity $ThirdLoginEntityFromJson(Map<String, dynamic> json) {
  final ThirdLoginEntity thirdLoginEntity = ThirdLoginEntity();
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    thirdLoginEntity.email = email;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    thirdLoginEntity.avatar = avatar;
  }
  final String? nickName = jsonConvert.convert<String>(json['nickName']);
  if (nickName != null) {
    thirdLoginEntity.nickName = nickName;
  }
  final String? token = jsonConvert.convert<String>(json['token']);
  if (token != null) {
    thirdLoginEntity.token = token;
  }
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    thirdLoginEntity.uid = uid;
  }
  return thirdLoginEntity;
}

Map<String, dynamic> $ThirdLoginEntityToJson(ThirdLoginEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['email'] = entity.email;
  data['avatar'] = entity.avatar;
  data['nickName'] = entity.nickName;
  data['token'] = entity.token;
  data['uid'] = entity.uid;
  return data;
}

extension ThirdLoginEntityExt on ThirdLoginEntity {
  ThirdLoginEntity copyWith({
    String? email,
    String? avatar,
    String? nickName,
    String? token,
    String? uid,
  }) {
    return ThirdLoginEntity()
      ..email = email ?? this.email
      ..avatar = avatar ?? this.avatar
      ..nickName = nickName ?? this.nickName
      ..token = token ?? this.token
      ..uid = uid ?? this.uid;
  }
}